// TestConsole.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <iostream>
#include <WinSock2.h>
#include <log4cpp/Category.hh>

#include <librtp.h>

static log4cpp::Category& Logger = log4cpp::Category::getInstance(std::string("TestConsole"));

int _tmain(int argc, _TCHAR* argv[])
{

	WSADATA dat;
	WSAStartup(MAKEWORD(2,2),&dat);

	char inputChar;

	unsigned char ipAddr[4] = {127,0,0,1};

	HRESULT hr = CoInitialize(NULL);
	if (FAILED(hr))
	{
		WSACleanup();
		std::cout << "Couldn't initialize COM" << std::endl;
		return -1;
	}

	Logger.info("TestConsole Start");


	// test audio


	std::cout << "Input Any Char to start audio" << std::endl;
	std::cin >> inputChar;

	AudioParam audioParam;
	librtp_audio_param_init(&audioParam);
	librtp_audio_init(&audioParam);
	librtp_audio_startSession();
	librtp_audio_addDestination(ipAddr,6000);

	std::cout << "Input Any Char to stop Audio" << std::endl;
	std::cin >> inputChar;

	librtp_audio_stopSession();
	librtp_audio_close();

	// test Video Here

	std::cout << "Input Any Char to start video" << std::endl;
	std::cin >> inputChar;

	VideoParam videoParam;

	librtp_video_param_init(&videoParam);
	librtp_video_init(&videoParam);
	librtp_video_startSession();

	librtp_video_addDestination(ipAddr,6100);

	std::cout << "Input Any Char to stop video" << std::endl;
	std::cin >> inputChar;

	librtp_video_stopSession();
	librtp_video_close();


	Logger.info("TestConsole Exit");

	CoUninitialize();	
	WSACleanup();

	return 0;
}

